﻿
Imports Mysoft.Map.Data
Imports System.Data
Imports System.Web.UI.WebControls
Imports System.Text
Imports System.Web.UI
Imports Mysoft.PubProject.Business

Partial Class Cwjk_SetHsxm_Map
    Inherits Mysoft.Map.Application.Security.AppPage

#Region " Web 窗体设计器生成的代码 "

    '该调用是 Web 窗体设计器所必需的。
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    '注意: 以下占位符声明是 Web 窗体设计器所必需的。
    '不要删除或移动它。
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
        '不要使用代码编辑器修改它。
        InitializeComponent()
    End Sub

#End Region

#Region "Repeater初始化函数"
    Private Sub Data_Bind()
        Dim sProjGUID As String = ""
        Dim sFilter As String = ""
        Dim myGetMap As New CwjkMNG

        '查询语句
        Select Case Trim(sOperObject)
            Case "项目名称"
                sFilter = MyDB.GetProjectFilterExp(Session("UserGUID"), "p_project", Session("BUGUID"), "0101")
                If Trim(sFilter) <> "" Then
                    Dim intOf As Integer

                    sFilter = sFilter.Replace("','", ",").Replace("'", "")
                    intOf = sFilter.IndexOf("(")
                    sFilter = sFilter.Substring(intOf + 1).Replace(")", "")
                End If
                Exit Select
            Case "楼栋名称"
                sProjGUID = Request.QueryString("projguid")
                Exit Select
            Case "房间信息"
                Dim myArr() As String

                sProjGUID = Request.QueryString("projguid")
                myArr = sProjGUID.Split(";")

                If myArr.Length > 0 Then
                    sFilter = myArr(1)
                End If

                Exit Select
        End Select

        '自定义控件绑定数据
        Repeater1.BindMode = 1                                          '绑定模式：0 -- SQL 语句绑定，1 -- DataTable 绑定
        Repeater1.PKField = "HsxmMapGUID"
        Repeater1.DataTable = myGetMap.GetKjkmOrHsxmDT("HSXM", Session("BUGUID"), txtCwztGUID.Text, sProjGUID, sOperObject, "", txtKmTypeGUID.Text, txtApplication.Text, sFilter)
        Repeater1.DataBind()                                            '绑定数据
    End Sub

#End Region

    Dim sCwztGUID, sKmtypeGUID, sOperObject, sOpenRoot As String

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            If Not Request.QueryString("Export") Is Nothing Then
                txtIsExport.text = Request.QueryString("Export").ToString
            End If
        End If

        Dim sApplication As String
        sApplication = Request.QueryString("Application")
        txtApplication.Text = Trim(sApplication)

        sCwztGUID = Request.QueryString("cwztguid")
        sKmtypeGUID = Request.QueryString("kmtypeguid")
        sOperObject = Request.QueryString("operobject")
        sOpenRoot = Request.QueryString("openroot")

        txtCwztGUID.Text = Trim(sCwztGUID)
        txtKmTypeGUID.Text = Trim(sKmtypeGUID)
        txtOperObject.Text = Trim(sOperObject)
        txtOpenRoot.Text = Trim(sOpenRoot)

        '前端：         __doPostBack(__EVENTTARGET, __EVENTARGUMENT);
        Dim strEventTgt As String = Trim(Request.Form("__EVENTTARGET"))
        Dim strEventArg As String = Trim(Request.Form("__EVENTARGUMENT"))
        Select Case strEventTgt.ToUpper
            Case "REFRESH"                        '修改后刷新显示
                Data_Bind()
                Exit Select
            Case Else
                Data_Bind()
        End Select

    End Sub

End Class
